<#include "/generation-templates/directive/field-type.ftl"/>
<#include "/generation-templates/directive/field-comment.ftl"/>
package ${package};

import ${basePackage}.entity.${table.getCamelName()};
import ${basePackage}.form.search.${table.getCamelName()}SearchForm;
<#list table.getFields() as field>
<#if field.getRules().match("enum")>
import ${field.getType().getName()};
</#if>
</#list>

/**
 * ${table.getComment()}服务接口类
 * @author venus
 */
public interface ${table.getCamelName()}Service extends SearchableService<${table.getCamelName()}, ${primary.getType().getSimpleName()}, ${table.getCamelName()}SearchForm> {

    <#list table.getFields() as field>
    <#if field.getRules().match("unique")>
    /**
     * 判断${field.getComment()}是否存在
     * @param ${field.getLowerCamelName()} ${field.getComment()}
     * @return 存在的${table.getComment()}
     */
    <#if field.getRules().getRule("unique").getParam("method")?has_content>
    ${table.getCamelName()} ${field.getRules().getRule("unique").getParam("method")}(String ${field.getLowerCamelName()});
    <#else>
    ${table.getCamelName()} ${field.getLowerCamelName()}Exists(String ${field.getLowerCamelName()});
    </#if>

    </#if>
    </#list>
    <#if table.getRules().match("multiUnique")>
    /**
     * 判断<#list table.getRules().getRule("multiUnique").getParam("fields")?split("-") as val>${val}<#sep>, </#list>确定的记录是否存在
     <#list table.getRules().getRule("multiUnique").getParam("fields")?split("-") as val>
     * @param ${val} <@fieldComment tableInfo = table name = val ; comment>${comment}</@fieldComment>
     </#list>
     * @return 存在的${table.getComment()}
     */
    <#if table.getRules().getRule("multiUnique").getParam("method")?has_content>
    ${table.getCamelName()} ${table.getRules().getRule("multiUnique").getParam("method")}(<#list table.getRules().getRule("multiUnique").getParam("fields")?split("-") as val><@fieldType tableInfo = table name = val ; type>${type}</@fieldType> ${val}<#sep>, </#list>);
    <#else>
    ${table.getCamelName()} <#list table.getRules().getRule("multiUnique").getParam("fields")?split("-") as val><#if val?is_first>${val}<#else>${val?cap_first}</#if><#sep>And</#list>Exists(<#list table.getRules().getRule("multiUnique").getParam("fields")?split("-") as val><@fieldType tableInfo = table name = val ; type>${type}</@fieldType> ${val}<#sep>, </#list>);
    </#if>

    </#if>
}
